import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InspectionrecordsVO, InspectionrecordsForm, InspectionrecordsQuery } from '@/api/facility/inspection/inspection-records/types';

/**
 * 查询巡检记录列表
 * @param query
 * @returns {*}
 */

export const listInspectionrecords = (query?: InspectionrecordsQuery): AxiosPromise<InspectionrecordsVO[]> => {
  return request({
    url: '/inspection/inspectionRecords/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡检记录详细
 * @param patrolInspectionRecordsId
 */
export const getInspectionrecords = (patrolInspectionRecordsId: string | number): AxiosPromise<InspectionrecordsVO> => {
  return request({
    url: '/system/inspectionRecords/' + patrolInspectionRecordsId,
    method: 'get'
  });
};

/**
 * 新增巡检记录
 * @param data
 */
export const addInspectionrecords = (data: InspectionrecordsForm) => {
  return request({
    url: '/system/inspectionRecords',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡检记录
 * @param data
 */
export const updateInspectionrecords = (data: InspectionrecordsForm) => {
  return request({
    url: '/system/inspectionRecords',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡检记录
 * @param patrolInspectionRecordsId
 */
export const delInspectionrecords = (patrolInspectionRecordsId: string | number | Array<string | number>) => {
  return request({
    url: '/system/inspectionRecords/' + patrolInspectionRecordsId,
    method: 'delete'
  });
};
